﻿using YDT_PaymentService.Domain.Entities;
using YDT_PaymentService.Domain.Enums;

namespace YDT_PaymentService.Domain.Interfaces
{
    /// <summary>
    /// 支付仓储接口 - 定义支付数据访问契约
    /// </summary>
    public interface IPaymentRepository
    {
        /// <summary>根据ID获取支付记录</summary>
        Task<Payment?> GetByIdAsync(Guid id);
        /// <summary>根据支付单号获取支付记录</summary>
        Task<Payment?> GetByPaymentCodeAsync(string paymentCode);
        /// <summary>根据订单ID获取支付记录</summary>
        Task<Payment?> GetByOrderIdAsync(Guid orderId);
        /// <summary>获取用户的所有支付记录</summary>
        Task<IEnumerable<Payment>> GetByUserIdAsync(Guid userId);
        /// <summary>根据状态获取支付记录</summary>
        Task<IEnumerable<Payment>> GetByStatusAsync(PaymentStatus status);
        /// <summary>获取所有支付记录</summary>
        Task<IEnumerable<Payment>> GetAllAsync();
        /// <summary>分页获取支付记录</summary>
        Task<(IEnumerable<Payment> Payments, int TotalCount)> GetPagedAsync(int pageIndex, int pageSize);
        /// <summary>添加支付记录</summary>
        Task AddAsync(Payment payment);
        /// <summary>更新支付记录</summary>
        Task UpdateAsync(Payment payment);
        /// <summary>删除支付记录</summary>
        Task DeleteAsync(Guid id);
        /// <summary>检查支付记录是否存在</summary>
        Task<bool> ExistsAsync(Guid id);
        /// <summary>检查支付单号是否存在</summary>
        Task<bool> PaymentCodeExistsAsync(string paymentCode);
    }
}
